Unit 4 Exercise 5
Exercise 5: Importing a Script
Objective
To import a script into the repository and create a job to run it.
Summary
In the Script Repository, import a script called ExerciseThreshold.cmd. Utilizing the existing schedule called Embedded Scripts Training, create a Job named ExerciseThreshold that runs the newly imported script.
Instructions
- In Library > Administration, select Scripts.
- Click Add.
- On the Add New Script page:
- In the Name field, enter
SetThreshold
- In the Type drop-down, select Command Shell.
- In the Description field, enter in some documentation.
- Verify that Role_ocadm is granted permissions.
- In the Comment box, leave Initial Version.
- In the Script field, click the Open File button.
- Navigate to the C:\scripts folder, select the ExerciseThreshold.cmd file and click Open.
- Click the Save button.
Create the Job
- In Library > Administration, select Master Schedules.
- Select Embedded Scripts Training and click View.
- Select Add Job in the side menu.
- In the Master Job Definition screen:
- In the Name textbox, enter
ExerciseThreshold
. - In the Job Type dropdown list, select Windows.
- In the Machine Selection dropdown list, select the SMATraining.
- In the User ID dropdown menu, select SMATRAINING\SMAUSER.
- In the Job Action dropdown list, select Embedded Script.
- In the Script dropdown list, select the SetThreshold.
- Leave the Version as LATEST (X).
- In the Runner dropdown menu, select Command Shell.
- In the Arguments textbox, type the following:
+2
- Click the Save button.
- Click the Lock icon in the upper right-hand corner.
- Give the Job a Frequency of Example-Mon-Fri-O.
- Click the Save button.
Validate the Initial Threshold Value
- Open Thresholds and check the current value of the TrainingThreshold. It should be
0
.
Build the Job
- In Processes, right-click on Embedded Scripts Training for today.
- Click the (+) icon in the side menu.
- In the Add Job pop-up window:
- Select Exercise Threshold and click the Next button.
- Change the Build Status to Released.
- Click the Next button.
- Click the Submit button.
- Close the Add Jobs results screen.
- Wait until the Job finishes OK.
- After the Job is finished, open the Thresholds tab and check the value. It must be
2
. - For practice, edit the Daily Job and change the value in the Arguments field to
0
, restart the Job and check the Threshold again.
note
The TrainingThreshold should have a value of 0 when this exercise is complete.
Enterprise Manager
Details
note
In this exercise we will import a script created in Unit 3 to the OpCon database
- Under the Scripts topic, Double-Click on Repository.
- Click the Add button in the Script Repository toolbar.
- Type SetThreshold in the Name textbox.
- Type some Documentation in the Description field.
- Click the Open File button.
- Navigate to the
C:\scripts
folder, select theExerciseThreshold.cmd
file and click Open. - The script is loaded to your screen.
- Select Command Shell from the Type drop-down list.
- Leave Initial Version in the Initial Comments textbox.
- Click the Save button.
- Assign a Script to a Role. (In this case, leave
Role_ocadm
as the Assigned Role). - Close the Scripts Repository tab.
- Under the Administration topic, Double-Click on Job Master.
- In the Schedule drop-down list, select Embedded Scripts Training.
- Click the Add button on the Job Master toolbar.
- In the Name textbox, enter ExerciseThreshold.
- In the Job Type drop-down list, select
Windows
. - In the Primary Machine drop-down list, select the
SMATraining
. - In the Job Action drop-down list, select
Embedded Script
. - In the User ID drop-down menu, select
SMATRAINING\SMAUSER
. - In the Script drop-down list, select the
SetThreshold
. - Leave the Version as
LATEST
. - In the Runner drop-down menu, select
Command Shell
. - In the Arguments textbox, type the following:
+2
- Click the Save button.
- Give the Job a Frequency of
Mon-Fri-N
. - Add Documentation and then close the Job Master.
- Open the Thresholds and check the current value of the TrainingThreshold. It should be
0
. - Close the Thresholds tab.
- Go to one of the operations screen, Right-Click the Embedded Scripts Training Schedule> Maintenance> Add Jobs.
- Select the ExerciseThreshold Job and click Add Job.
- Select the Released radio button and click Yes.
- Click Close.
- After the Job is finished, open the Thresholds tab and check the value. It must be
2
. - Close the Thresholds tab.
- For practice, edit the Daily Job changing the Parameter back to
0
, restart the Job and check the Threshold again.